package com.fms.kccc.service;

import com.fms.kccc.util.ConnectionDetector;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class NetworkReceiver extends BroadcastReceiver {

	private OnChangeNetworkStateListener listener;

	public NetworkReceiver(Context context,
			OnChangeNetworkStateListener listener) {
		this.listener = listener;
	}

	@Override
	public void onReceive(Context context, Intent arg1) {
		ConnectionDetector cd = new ConnectionDetector(context);
		if (listener != null) {
			listener.onChange(cd.isConnectingToInternet());
		}
	}

	public interface OnChangeNetworkStateListener {
		void onChange(boolean isOnline);
	}
}
